<!DOCTYPE html>
<html lang="en">
<head>
    {% include 'admin/common/header.html' %}
    <link rel="stylesheet" href="{{ url_for('static', filename='admin/admin/css/other/user.css') }}"/>
</head>
<body class="pear-container">
{# 查询表单 #}
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="" lay-filter="detail-query-form">
            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" placeholder="" class="layui-input">
                </div>

                <label class="layui-form-label">手机号码</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone" placeholder="" class="layui-input">
                </div>

                <label class="layui-form-label">状态</label>
                <div class="layui-input-inline">
                    <select name="flag">
                        <option value="0" selected="selected">中签</option>
                        <option value="1006">未中</option>
                    </select>
                </div>

                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="detail-query">
                    <i class="layui-icon layui-icon-search"></i>
                    查询
                </button>
                <button type="reset" class="pear-btn pear-btn-md">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </form>
    </div>
</div>
{# 表格 #}
<div class="user-main user-collasped">
    <div class="layui-card">
        <div class="layui-card-body">
            <table id="detail-table" lay-filter="detail-table"></table>
        </div>
    </div>
</div>
</body>

<script type="text/html" id="user-toolbar">

</script>



<script type="text/html" id="user-createTime">
    {{ '  {{layui.util.toDateString(d.create_at,  "yyyy-MM-dd HH:mm:ss")}' |safe }}}
</script>

{% include 'admin/common/footer.html' %}

<script>
    layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () {
        let table = layui.table;
        let form = layui.form;
        let $ = layui.jquery;
        let popup = layui.popup;
        let MODULE_PATH = '/walmart/record/'

        // 表格数据
        let cols = [
            [
                {title: 'id', field: 'id', align: 'center', width:'5%'},
                {title: '姓名', field: 'name', align: 'center', width:'10%'},
                {title: '手机号', field: 'phone', align: 'center', width:'15%'},
                { title: '结果', field: 'msg_result', align: 'center', width:'40%' },
                {title: '创建时间', field: 'create_at', templet: '#user-createTime', align: 'center', width:'20%'}
            ]
        ]

        // 渲染表格数据
        table.render({
            elem: '#detail-table',
            url: MODULE_PATH + 'detailData?batch_no={{ batch_no }}',
            page: true,
            cols: cols,
            skin: 'line',
            height: 'full-148',
            toolbar: '#user-toolbar', /*工具栏*/
            text: {none: '暂无调用记录'},
            defaultToolbar: [{layEvent: 'refresh', icon: 'layui-icon-refresh'}, 'filter', 'print', 'exports'] /*默认工具栏*/
        })


        form.on('submit(detail-query)', function (data) {
            window.refresh(data.field)
            return false
        })


        window.refresh = function (param) {
            table.reload('detail-table', {where: param})
        }
    })
</script>
</html>